home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume19 / parseargs / patch05a next >
Encoding:
Text File  |  1991-05-17  |  55.9 KB  |  1,321 lines

  1. Newsgroups: comp.sources.misc
  2. From: Brad Appleton <brad@hcx1.ssd.csd.harris.com>
  3. Subject:  v19i082:  parseargs - functions to parse command line argument, Patch05a/5
  4. Message-ID: <1991May17.181527.22168@sparky.IMD.Sterling.COM>
  5. X-Md4-Signature: 8c374620d01516b8c5214277cdbf721a
  6. Date: Fri, 17 May 1991 18:15:27 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: Brad Appleton <brad@hcx1.ssd.csd.harris.com>
  10. Posting-number: Volume 19, Issue 82
  11. Archive-name: parseargs/patch05a
  12. Patch-To: parseargs: Volume 17, Issue 45-57
  13.  
  14. This is the first part of Patch05, a five part patch to parseargs. 
  15.  
  16. Changes made in Patch05
  17.     - documented support for zsh in parseargs(1)
  18.     - added missing call to pclose() in pgopen.c:pgclose()
  19.     - added zsh to the list of shells supported by parseargs(1)
  20.     - changed the shell_info structure used by parseargs(1) to 
  21.       represent different shells. It should now be much simpler
  22.       to add new shells to parseargs.c
  23.     - fixed a bug in strfuncs.c:basename() for VMS systems
  24.     - added more comments to explain whats going on in each <os>_args.c
  25.     - updated the README file to correspond with the patchlevel(s)
  26.     - updated dependencies in doc/Makefile
  27.  
  28. Brad Appleton
  29. -----
  30. #!/bin/sh
  31. # This is a shell archive (produced by shar 3.49)
  32. # To extract the files from this archive, save it to a file, remove
  33. # everything above the "!/bin/sh" line above, and type "sh file_name".
  34. #
  35. # made 05/14/1991 17:54 UTC by kent@sparky.IMD.Sterling.COM
  36. # Source directory /u1/csm/queue/parseargs/test/patches
  37. #
  38. # existing files will NOT be overwritten unless -c is specified
  39. #
  40. # This is part 1 of a multipart archive                                    
  41. # do not concatenate these parts, unpack them in order with /bin/sh        
  42. #
  43. # This shar contains:
  44. # length  mode       name
  45. # ------ ---------- ------------------------------------------
  46. # 268263 -rw-rw-r-- PATCH05
  47. #
  48. if test -r _shar_seq_.tmp; then
  49.     echo 'Must unpack archives in sequence!'
  50.     echo Please unpack part `cat _shar_seq_.tmp` next
  51.     exit 1
  52. fi
  53. # ============= PATCH05 ==============
  54. if test -f 'PATCH05' -a X"$1" != X"-c"; then
  55.     echo 'x - skipping PATCH05 (File already exists)'
  56.     rm -f _shar_wnt_.tmp
  57. else
  58. > _shar_wnt_.tmp
  59. echo 'x - extracting PATCH05 (Text)'
  60. sed 's/^X//' << 'SHAR_EOF' > 'PATCH05' &&
  61. diff -cNr ../patchlevel4/Intro ./Intro
  62. *** ../patchlevel4/Intro    Thu May  2 10:56:07 1991
  63. --- ./Intro    Thu May  2 14:34:14 1991
  64. ***************
  65. *** 51,58 ****
  66. X   Parseargs consists of a set of C-functions to parse arguments from the
  67. X   command-line, from files, from strings, from linked-lists, and from
  68. X   string-vectors. Also included is a command-line interface which will parse
  69. !  arguments for shell scripts (sh, csh/tcsh, ksh, bash, and rc), awk-scripts,
  70. !  and perl-scripts.
  71. X  
  72. X   The basic structure used by parseargs is the argument-descriptor (sometimes
  73. X   called "argdesc" for brevity).  An array/string of argdescs is declared by
  74. --- 51,58 ----
  75. X   Parseargs consists of a set of C-functions to parse arguments from the
  76. X   command-line, from files, from strings, from linked-lists, and from
  77. X   string-vectors. Also included is a command-line interface which will parse
  78. !  arguments for shell scripts (sh, csh/tcsh/itcsh, ksh, bash, zsh, and rc),
  79. !  awk-scripts, and perl-scripts.
  80. X  
  81. X   The basic structure used by parseargs is the argument-descriptor (sometimes
  82. X   called "argdesc" for brevity).  An array/string of argdescs is declared by
  83. ***************
  84. *** 78,86 ****
  85. X   or from a shell script as in the following example:
  86. X  
  87. X      echo "$ARGDESC_STR" | parseargs -s sh -- "$0" "$@" >tmp$$
  88. !     if [ $? = 0 ] ; then
  89. !        . tmp$$
  90. !     fi
  91. X      /bin/rm -f tmp$$
  92. X  
  93. X   And before you know it, your command-line had been parsed, all variables 
  94. --- 78,84 ----
  95. X   or from a shell script as in the following example:
  96. X  
  97. X      echo "$ARGDESC_STR" | parseargs -s sh -- "$0" "$@" >tmp$$
  98. !     test  $? = 0  &&  . tmp$$
  99. X      /bin/rm -f tmp$$
  100. X  
  101. X   And before you know it, your command-line had been parsed, all variables 
  102. diff -cNr ../patchlevel4/MANIFEST ./MANIFEST
  103. *** ../patchlevel4/MANIFEST    Thu May  2 11:06:06 1991
  104. --- ./MANIFEST    Thu May  2 13:00:33 1991
  105. ***************
  106. *** 6,12 ****
  107. X   Makefile.cpp               3    makefile template read by the C preprocessor
  108. X   README                     1    release information
  109. X   amiga_args.c               4    parse AmigaDOS command-lines
  110. !  arglist.c                  2    implement the listXxxx functions for arglists
  111. X   argtype.c                  5    implement the argXxxx argument type functions
  112. X   doc                        1    directory containing documentation
  113. X   doc/Makefile               2    makefile for the documentation
  114. --- 6,12 ----
  115. X   Makefile.cpp               3    makefile template read by the C preprocessor
  116. X   README                     1    release information
  117. X   amiga_args.c               4    parse AmigaDOS command-lines
  118. !  arglist.c                  3    implement the listXxxx functions for arglists
  119. X   argtype.c                  5    implement the argXxxx argument type functions
  120. X   doc                        1    directory containing documentation
  121. X   doc/Makefile               2    makefile for the documentation
  122. ***************
  123. *** 15,21 ****
  124. X   doc/argflags.inc           2    describe argument flags
  125. X   doc/argtype.man3           3    {n,t}roff source for argtype(3)
  126. X   doc/argvalopt.inc          1    describe options with optional arguments
  127. !  doc/bugs.inc               2    BUGS section for parseargs(1)
  128. X   doc/caveats.inc            1    CAVEATS section for parseargs(1) and (3)
  129. X   doc/cmd_macros.inc         1    describe CMD_XXX macros
  130. X   doc/defargs.inc            1    describe the default argdesc-array
  131. --- 15,21 ----
  132. X   doc/argflags.inc           2    describe argument flags
  133. X   doc/argtype.man3           3    {n,t}roff source for argtype(3)
  134. X   doc/argvalopt.inc          1    describe options with optional arguments
  135. !  doc/bugs.inc               1    BUGS section for parseargs(1)
  136. X   doc/caveats.inc            1    CAVEATS section for parseargs(1) and (3)
  137. X   doc/cmd_macros.inc         1    describe CMD_XXX macros
  138. X   doc/defargs.inc            1    describe the default argdesc-array
  139. ***************
  140. *** 44,56 ****
  141. X   doc/vparseargs3.inc        1    describe vparseargs(3)
  142. X   ibm_args.c                 5    parse MS-DOS and OS/2 command-lines
  143. X   parseargs.awk              3    parseargs for awk
  144. !  parseargs.c                7    C source for parseargs(1)
  145. !  parseargs.h                6    include file for parseargs library
  146. X   parseargs.pl               2    parseargs for perl
  147. !  patchlevel.h               1    list of patches (most recent first)
  148. X   pgopen.c                   4    pipe output to a pager
  149. X   pgopen.h                   1    include file for pgopen.c
  150. !  stest.c                    3    test progarm for parseargs(3)
  151. X   strfuncs.c                 6    string library
  152. X   strfuncs.h                 1    include file for strfuncs.c
  153. X   syserr.c                   2    diagnostic message printing routines
  154. --- 44,56 ----
  155. X   doc/vparseargs3.inc        1    describe vparseargs(3)
  156. X   ibm_args.c                 5    parse MS-DOS and OS/2 command-lines
  157. X   parseargs.awk              3    parseargs for awk
  158. !  parseargs.c                8    C source for parseargs(1)
  159. !  parseargs.h                7    include file for parseargs library
  160. X   parseargs.pl               2    parseargs for perl
  161. !  patchlevel.h               2    list of patches (most recent first)
  162. X   pgopen.c                   4    pipe output to a pager
  163. X   pgopen.h                   1    include file for pgopen.c
  164. !  stest.c                    4    test program for parseargs(3)
  165. X   strfuncs.c                 6    string library
  166. X   strfuncs.h                 1    include file for strfuncs.c
  167. X   syserr.c                   2    diagnostic message printing routines
  168. ***************
  169. *** 60,69 ****
  170. X   test.pl                    1    perl test program for parseargs(1)
  171. X   test.rc                    1    Plan 9 shell test program for parseargs(1)
  172. X   test.sh                    1    Bourne shell test program for parseargs(1)
  173. !  unix_args.c                4    parse Unix command-lines
  174. X   unix_man.c                 3    print Unix manual-page templates
  175. X   useful.h                   3    common include file for the library
  176. !  vms_args.c                 5    parse VAX/VMS DCL command-lines
  177. X   vprintf.c                  3    portable vfprintf, vprintf, and vsprintf
  178. X   winsize.c                  3    determine # rows and # columns of window
  179. !  xparse.c                   8    implement the parseargs library
  180. --- 60,70 ----
  181. X   test.pl                    1    perl test program for parseargs(1)
  182. X   test.rc                    1    Plan 9 shell test program for parseargs(1)
  183. X   test.sh                    1    Bourne shell test program for parseargs(1)
  184. !  test.zsh                   2    Z shell test program for parseargs(1)
  185. !  unix_args.c                5    parse Unix command-lines
  186. X   unix_man.c                 3    print Unix manual-page templates
  187. X   useful.h                   3    common include file for the library
  188. !  vms_args.c                 6    parse VAX/VMS DCL command-lines
  189. X   vprintf.c                  3    portable vfprintf, vprintf, and vsprintf
  190. X   winsize.c                  3    determine # rows and # columns of window
  191. !  xparse.c                   9    implement the parseargs library
  192. diff -cNr ../patchlevel4/README ./README
  193. *** ../patchlevel4/README    Thu May  2 10:56:10 1991
  194. --- ./README    Thu May  2 14:34:23 1991
  195. ***************
  196. *** 58,106 ****
  197. X  
  198. X   CONTENTS
  199. X   ========
  200. !      README : this file.
  201. !      [ Intro : introduction to parseargs -- BDA ]
  202. !      [ doc/Makefile : makefile for parseargs documentation -- BDA ]
  203. !      [ doc/* : documentation for parseargs -- BDA ]
  204. !      Makefile : a makefile for the library.
  205. !      [ Makefile.cpp : a makefile template -- BDA ]
  206. !      useful.h : a general header file, used by most everything.
  207. !      parseargs.h : headers for the argument parser.
  208. !      [ parseargs.c is now broken down into the following files : PDS ]
  209. !          unix_args.c : a command line argument parser. Popular
  210. !              response to my C Advisor column about this routine
  211. !              in UNIX Review Vol. 7 No. 11 prompted me to make
  212. !              this distribution available.
  213. !          amiga_args.c : Amiga version of unix_args.c -- PDS
  214. !          ibm_args.c : IBM-PC version of unix_args.c -- BDA
  215. !          vms_args.c : VAX/VMS version of unix_args.c -- BDA
  216. !          arglist.c : routines for ARGLIST options. -- PDS
  217. !          argtype.c : routines for other options. The argument value parsers
  218. !              for floating point values may be excluded by #defining the
  219. !              macro NOFLOAT (only if you do NOT need floating-point values).
  220. !              I had to break this out because RISC/os 4.01 from Mips doesn't
  221. !              seem to support strtod in the BSD environment. You may find you
  222. !              need to include -lm for this to work.
  223. !          strfuncs.[ch] : string-manipulation functions &
  224. !              dictionary-style searching routines.
  225. !      [ end of parseargs.c : PDS ]
  226. !      [ parseargs.c has been resurrected as a command line interface
  227. !              to the parseargs library routines -- BDA ]
  228. !      syserr.c : error message printing routines.
  229. !      stest.c : a small test program for the argument parser.
  230. !      [ xparse.c : source for [flsv]parseargs() and parsecntl() -- BDA ]
  231. !      [ unix_man.c : routine to print unix man1 templates -- BDA ]
  232. !      [ winsize.c : routine to "portably" get the screen size -- BDA ]
  233. !      [ pgopen.[ch] : Unix source to pipe output to a pager -- BDA ]
  234. !      [ vprintf.c : portable implementations of vprintf() & vfprintf() ]
  235. !      [ parseargs.awk : awk interface to parseargs(1) -- BDA ]
  236. !      [ parseargs.pl : perl interface to parseargs(1) -- BDA ]
  237. !      [ test.sh : Bourne shell-script to test parseargs(1) -- BDA ]
  238. !      [ test.csh : C shell-script to test parseargs(1) -- BDA ]
  239. !      [ test.ksh : Korn shell-script to test parseargs(1) -- BDA ]
  240. !      [ test.awk : awk script to test parseargs(1) -- BDA ]
  241. !      [ test.pl : perl script to test parseargs(1) -- BDA ]
  242. X  
  243. X   The parseargs routines really ought to have a way of matching a  list
  244. X   (e.g., return the rest of argv). This isn't especially hard to do, but
  245. X   I haven't gotten around to it yet. [ Added, with ARGLIST flag -- PDS ]
  246. --- 58,68 ----
  247. X  
  248. X   CONTENTS
  249. X   ========
  250. !  See the file "MANIFEST" in the distribution for a complete list and
  251. !  description of all the files included in this release.
  252. X  
  253. +  TO DO
  254. +  =====
  255. X   The parseargs routines really ought to have a way of matching a  list
  256. X   (e.g., return the rest of argv). This isn't especially hard to do, but
  257. X   I haven't gotten around to it yet. [ Added, with ARGLIST flag -- PDS ]
  258. ***************
  259. *** 261,268 ****
  260. X  
  261. X               Update to parseargs (and major re-write) by Brad Appleton
  262. X                          (brad@travis.ssd.csd.harris.com)
  263. !                               Last Update: 03/01/91
  264. X  
  265. X   DISCLAIMER
  266. X   ==========
  267. X   Neither Brad Appleton, nor Harris Corporation (including any of its
  268. --- 223,237 ----
  269. X  
  270. X               Update to parseargs (and major re-write) by Brad Appleton
  271. X                          (brad@travis.ssd.csd.harris.com)
  272. !                               Last Update: 04/12/91
  273. !  
  274. X  
  275. +  THIS RELEASE
  276. +  ============
  277. +  Read the file patchlevel.h in the distribution to find out what version
  278. +  and patchlevel of parseargs you have received.
  279. X   DISCLAIMER
  280. X   ==========
  281. X   Neither Brad Appleton, nor Harris Corporation (including any of its
  282. ***************
  283. *** 427,449 ****
  284. X   If someone wants to try to add more shell-types to parseargs.c, here
  285. X   are the main things that need to be done:
  286. X  
  287. !  1. add #defines for both the name (a string) and type (an integer) of
  288. !     shell (e.g #define BOURNE_SHELL "sh" and #define SH 4)
  289. X  
  290. !  2. add a shell_info entry into the array Shell[]. The index of the
  291. !     entry in the array should be the number used in the #define for the
  292. !     type of shell.
  293. !  3. make sure that get_shell_type() will return the proper value for
  294. !     the new shell.
  295. !  4. print_args doesnt really do any shell specific stuff outside of
  296. !     indexing into the table. The print_arglist() and
  297. !     unset_positional_parameters() functions do some shell specific stuff
  298. !     and will need a case added to the switch statement(s) for the newly
  299. !     added shell.
  300. X  
  301. !  5. If the information in the shell-info structure is not sufficient
  302. X      for the new shell then you should either:
  303. X         a) redefine the structure for all shells including your shell.
  304. X         b) add some special code into print_args() for your shell!
  305. --- 396,412 ----
  306. X   If someone wants to try to add more shell-types to parseargs.c, here
  307. X   are the main things that need to be done:
  308. X  
  309. !  1. add an entry for the shell type into the type definition for the
  310. !     "shell_t" enumerated type.
  311. X  
  312. !  2. add a shell_info entry for the shell into the array Shell[].
  313. X  
  314. !  3. print_args doesnt really do any shell specific stuff outside of
  315. !     indexing into the table. The print_arglist() function does some
  316. !     shell specific stuff and MAY need a case added to the switch statement(s)
  317. !     for the newly added shell.
  318. !  4. If the information in the shell-info structure is not sufficient
  319. X      for the new shell then you should either:
  320. X         a) redefine the structure for all shells including your shell.
  321. X         b) add some special code into print_args() for your shell!
  322. ***************
  323. *** 786,792 ****
  324. X          NAME                        OS
  325. X      ------------------   ------------------------
  326. X       unix                Unix (BSD or AT&T)
  327. !      BSD, ucb_universe   BSD Unix (only one need be present)
  328. X       MANX, AZTEC         AmigaDOS
  329. X       MSDOS               MS-DOS for IBM PCs
  330. X       OS2                 OS/2 for IBM PCs
  331. --- 749,755 ----
  332. X          NAME                        OS
  333. X      ------------------   ------------------------
  334. X       unix                Unix (BSD or AT&T)
  335. !      BSD, SYSV           BSD Unix or AT&T Unix (only one should be present)
  336. X       MANX, AZTEC         AmigaDOS
  337. X       MSDOS               MS-DOS for IBM PCs
  338. X       OS2                 OS/2 for IBM PCs
  339. ***************
  340. *** 817,823 ****
  341. X   By default, if SWITCHAR is undefined then both the long and short
  342. X   option prefix character are '/'. One is able to distinguish an option
  343. X   from a long-option in this case because the third character of an
  344. !  option-arg will always be '=' or ' '. Hence, using the test program
  345. X   with the defaults, both "ibm_test foo /D=directory" and "ibm_test
  346. X   /DIR=directory" are equivalent.
  347. X  
  348. --- 780,786 ----
  349. X   By default, if SWITCHAR is undefined then both the long and short
  350. X   option prefix character are '/'. One is able to distinguish an option
  351. X   from a long-option in this case because the third character of an
  352. !  option-arg will always be '=' or '\0'. Hence, using the test program
  353. X   with the defaults, both "ibm_test foo /D=directory" and "ibm_test
  354. X   /DIR=directory" are equivalent.
  355. X  
  356. ***************
  357. *** 852,859 ****
  358. X   thanks to posters from comp.os.vms for giving me a clue on how to do
  359. X   this). As a result of this, under VAX/VMS, there are two new argtype
  360. X   functions "argInput" and "argOutput": each requires that ad->ad_valp
  361. !  be a  file pointer (not a pointer to a file pointer as in "__ &stdin"
  362. !  but an actual file pointer as in "__ stdin"). ArgInput and argOutput
  363. X   close the stream associated with the given file-pointer and reconnect
  364. X   the stream to the named file for input or output (so the effect is to
  365. X   redirect input (output) from (to) the stream to the named file. If
  366. --- 815,822 ----
  367. X   thanks to posters from comp.os.vms for giving me a clue on how to do
  368. X   this). As a result of this, under VAX/VMS, there are two new argtype
  369. X   functions "argInput" and "argOutput": each requires that ad->ad_valp
  370. !  be a pointer to a file pointer (not a FILE * variable as in "__ stdin"
  371. !  but an actual FILE ** variable as in "__ &stdin"). ArgInput & argOutput
  372. X   close the stream associated with the given file-pointer and reconnect
  373. X   the stream to the named file for input or output (so the effect is to
  374. X   redirect input (output) from (to) the stream to the named file. If
  375. ***************
  376. *** 888,904 ****
  377. X   vms_args.c as well.
  378. X  
  379. X  
  380. X   LITERATE PROGRAMMING
  381. X   ====================
  382. X   If you look at the source code you will notice that it contains lots
  383. X   of funny looking comments with sections that have titles enclosed
  384. X   between '^' and ':' characters. This is my own feeble attempt at
  385. !  literate programming. I  have a Unix-shell script which will extract
  386. !  certain portions of these "structured" comments so that I  may dump
  387. !  them directly into the documentation (and thus attempt to keep the
  388. !  documentation up-to-date at the same rate as the source). If anyone
  389. !  is interested in my script(s) please let me know and I will gladly e-
  390. !  mail them to the interested parties.
  391. X  
  392. X  
  393. X   ACKNOWLEDGEMENTS
  394. --- 851,879 ----
  395. X   vms_args.c as well.
  396. X  
  397. X  
  398. +  TO DO
  399. +  =====
  400. +  - get parseargs(1) to work for DCL under VMS using symbols
  401. +  - add ash to the list of shells supported by parseargs(1)
  402. +  - add clam to the list of shells supported by parseargs(1)
  403. +  - get parseargs(1) to support arrays for bash
  404. +  - verify that parseargs(1) works for rc, the Plan 9 shell
  405. +  - verify that parseargs(1) works for zsh
  406. +  - verify that parseargs(3) works on VMS systems.
  407. +  - verify that parseargs(3) works on MS-DOS and OS/2 systems.
  408. X   LITERATE PROGRAMMING
  409. X   ====================
  410. X   If you look at the source code you will notice that it contains lots
  411. X   of funny looking comments with sections that have titles enclosed
  412. X   between '^' and ':' characters. This is my own feeble attempt at
  413. !  literate programming. I have a Korn shell script (xdoc) which will
  414. !  extract certain portions of these "structured" comments so that I may
  415. !  dump them directly into the documentation (and thus attempt to keep
  416. !  the documentation up-to-date at the same rate as the source). If anyone
  417. !  is interested in my script(s) please let me know and I will gladly
  418. !  e-mail them to the interested parties.
  419. X  
  420. X  
  421. X   ACKNOWLEDGEMENTS
  422. ***************
  423. *** 905,911 ****
  424. X   ================
  425. X   I was in constant contact with Peter Da Silva during the entire period
  426. X   that I  implemented all of the above modifications and would like to
  427. !  thank him for his time and his sage advice.
  428. X  
  429. X   Thanx also to Jim Barbour for helping me with some VMS specific things
  430. X   (like getting the original, unparsed command-line from DCL and
  431. --- 880,887 ----
  432. X   ================
  433. X   I was in constant contact with Peter Da Silva during the entire period
  434. X   that I  implemented all of the above modifications and would like to
  435. !  thank him for his time and his sage advice. Many of the ideas which I 
  436. !  implemented are a direct result of our discussions.
  437. X  
  438. X   Thanx also to Jim Barbour for helping me with some VMS specific things
  439. X   (like getting the original, unparsed command-line from DCL and
  440. ***************
  441. *** 912,920 ****
  442. X   retreiving the value of a symbol), and to Tom Christiansen and Raymond
  443. X   Chen for their help in getting parseargs(1) to work for perl scripts.
  444. X  
  445. X   Lastly, thanks to all those who use and will continue to improve
  446. X   parseargs, all I ask is that you keep me updated of your efforts (so I
  447. X   can keep my own version of parseargs up-to-date). I am always eager
  448. X   to discuss possible changes or enhancements with any interested
  449. X   parties.
  450. --- 888,899 ----
  451. X   retreiving the value of a symbol), and to Tom Christiansen and Raymond
  452. X   Chen for their help in getting parseargs(1) to work for perl scripts.
  453. X  
  454. +  Thanx also to Gillmer J. Derge, Marco Nijdam, & Chris Johnston for sending
  455. +  me their bug reports and fixes so that I could incorporate them into the
  456. +  latest patch of parseargs.
  457. X   Lastly, thanks to all those who use and will continue to improve
  458. X   parseargs, all I ask is that you keep me updated of your efforts (so I
  459. X   can keep my own version of parseargs up-to-date). I am always eager
  460. X   to discuss possible changes or enhancements with any interested
  461. X   parties.
  462. diff -cNr ../patchlevel4/amiga_args.c ./amiga_args.c
  463. *** ../patchlevel4/amiga_args.c    Thu May  2 11:06:07 1991
  464. --- ./amiga_args.c    Thu May  2 14:34:25 1991
  465. ***************
  466. *** 199,205 ****
  467. X              ad = ARGDESCNULL;
  468. X           }/*else*/
  469. X        }
  470. !       else if (cmd_prev(cmd)) {
  471. X           flags = arg_flags(cmd_prev(cmd));    /* save flags */
  472. X           if ( ARG_isGIVEN(cmd_prev(cmd)) ) {   /* reset flags */
  473. X              BCLEAR( arg_flags(cmd_prev(cmd)), ARGVALSEP );
  474. --- 199,210 ----
  475. X              ad = ARGDESCNULL;
  476. X           }/*else*/
  477. X        }
  478. !       else if (cmd_prev(cmd)) { /* expecting a vlue from previous arg */
  479. !          /* reset the argument flags - if this arg was already given, some
  480. !          ** of its flags may be set to indicate how it was given before.
  481. !          ** we need to know how it was given now (but save the old ones
  482. !          ** just in case the new one fails).
  483. !          */
  484. X           flags = arg_flags(cmd_prev(cmd));    /* save flags */
  485. X           if ( ARG_isGIVEN(cmd_prev(cmd)) ) {   /* reset flags */
  486. X              BCLEAR( arg_flags(cmd_prev(cmd)), ARGVALSEP );
  487. ***************
  488. *** 228,233 ****
  489. --- 233,243 ----
  490. X        }
  491. X        else {  /* it's a positional argument or a list item */
  492. X           if ( cmd_list(cmd) ) { /* its a list item */
  493. +             /* reset the argument flags - if this arg was already given, some
  494. +             ** of its flags may be set to indicate how it was given before.
  495. +             ** we need to know how it was given now (but save the old ones
  496. +             ** just in case the new one fails).
  497. +             */
  498. X              flags = arg_flags(cmd_list(cmd));    /* save flags */
  499. X              if ( ARG_isGIVEN(cmd_list(cmd)) ) {   /* reset flags */
  500. X                 BCLEAR( arg_flags(cmd_list(cmd)), ARGVALSEP );
  501. ***************
  502. *** 243,248 ****
  503. --- 253,260 ----
  504. X              continue;
  505. X           }
  506. X           else {  /* its a positional argument */
  507. +             /* if FLAGS1ST is set then first positional marks end-of-flags */
  508. X              if ( BTEST(cmd_flags(cmd), pa_FLAGS1ST) )
  509. X                 BSET( cmd_state(cmd), ps_NOFLAGS );
  510. X  
  511. ***************
  512. *** 265,270 ****
  513. --- 277,287 ----
  514. X                 ad = ARGDESCNULL;
  515. X              }
  516. X              else {
  517. +                /* reset the argument flags - if this arg was already given, some
  518. +                ** of its flags may be set to indicate how it was given before.
  519. +                ** we need to know how it was given now (but save the old ones
  520. +                ** just in case the new one fails).
  521. +                */
  522. X                 flags = arg_flags(ad);    /* save flags */
  523. X                 if ( ARG_isGIVEN(ad) ) {   /* reset flags for this appearance */
  524. X                    BCLEAR( arg_flags(ad), ARGVALSEP );
  525. diff -cNr ../patchlevel4/argtype3.txt ./argtype3.txt
  526. *** ../patchlevel4/argtype3.txt    Thu May  2 11:06:44 1991
  527. --- ./argtype3.txt    Wed Dec 31 18:00:00 1969
  528. ***************
  529. *** 1,264 ****
  530. - ARGTYPE(3)                           ARGTYPE(3)
  531. - NAME
  532. -      argtype - argument    type functions used by parseargs(3)
  533. - SYNOPSIS
  534. -      #include <parseargs.h>
  535. -      BOOL  argUsage(  argdesc,    argstr,     copyf    );
  536. -      BOOL  argEnd(  argdesc,  argstr,  copyf  );
  537. -      BOOL  argDummy(  argdesc,    argstr,     copyf    );
  538. -      BOOL  argBool(  argdesc,  argstr,    copyf  );
  539. -      BOOL  argSBool(  argdesc,    argstr,     copyf    );
  540. -      BOOL  argUBool(  argdesc,    argstr,     copyf    );
  541. -      BOOL  argTBool(  argdesc,    argstr,     copyf    );
  542. -      BOOL  argChar(  argdesc,  argstr,    copyf  );
  543. -      BOOL  argStr(  argdesc,  argstr,  copyf  );
  544. -      BOOL  argInt(  argdesc,  argstr,  copyf  );
  545. -      BOOL  argShort(  argdesc,    argstr,     copyf    );
  546. -      BOOL  argLong(  argdesc,  argstr,    copyf  );
  547. -      BOOL  argFloat(  argdesc,    argstr,     copyf    );
  548. -      BOOL  argDouble(  argdesc,     argstr,  copyf     );
  549. -      BOOL  listStr(  argdesc,  argstr,    copyf  );
  550. -      void  listFree(  arglist  );
  551. -      void  vecFree(  argvec, type  );
  552. -      void  vecDeepFree(     argvec, type  );
  553. -      ARGDESC  *argdesc;
  554. -      char  *argstr;
  555. -      BOOL  copyf;
  556. -      ArgList  *arglist;
  557. - DESCRIPTION
  558. -      Each of these converts a parameter    value to the internal
  559. -      form, including validity checking.     Their parameters and
  560. -      return values all behave similarly. One of    these routines is
  561. -      called when an argument of    that particular    type is    matched
  562. -      by    one of the argument parsing function in    parseargs(3).
  563. -      When such an argument is matched, its argument translation
  564. -      routine is    invoked    and is passed (1) the address of the
  565. -      argument descriptor for the matched argument, (2) the possi-
  566. -      ble argument string for that matched argument, and    (3) a
  567. -      boolean field that    is TRUE    only if    the second parameter
  568. -      points to temporary storage (indicating that some copying
  569. -      may need to be done instead of just pointing to the same
  570. -      object).
  571. -      Once the argument translation routine is invoked, it is
  572. -      responsible for converting    the argument string to the
  573. -      desired internal form (perhaps a number), and assigning the
  574. -      resultant value to    the arg_valp(ad) field of the argument
  575. -      descriptor    (this includes handling    any necessary
  576. -      (re)allocation if the matched argument has    the ARGVEC flag
  577. -      enabled). If the argument is an ARGVEC or ARGLIST then the
  578. - Page 1
  579. - ARGTYPE(3)                           ARGTYPE(3)
  580. -      routine is    responsible for    allocating any space, copying the
  581. -      arg-flags to the value-specific flags, and    setting    the
  582. -      ARGCOPYF flag for the value if it needs to    be allocated as
  583. -      well.
  584. - RETURN VALUE
  585. -      TRUE    The conversion was    successful and the entire value
  586. -          was used.
  587. -      FALSE   The conversion failed.  The reason    for failure
  588. -          should be diagnosed using usrerr(3).
  589. -      -N         The conversion was    successful but only N characters
  590. -          of    the value were used, the remaining characters may
  591. -          still match other arguments.
  592. - PSEUDO-TYPES: argUsage,    argDummy, argEnd
  593. -      ArgUsage is used to specify an argument that causes the com-
  594. -      mand usage    to be printed.
  595. -      ArgDummy is used to force an item to show up in usage-
  596. -      messages but the item itself is never matched against any
  597. -      arguments from the    command-line.
  598. -      ArgEnd is used by Amiga style command-lines to indicate an
  599. -      argument that forces all remaining    arguments to be    con-
  600. -      sidered positional    args.
  601. -      These three are dummy functions. The routines themselves do
  602. -      nothing of    importance, we just need to have their addresses
  603. -      available for identification in the corresponding command-
  604. -      line styles.
  605. - STRING-TYPES: argStr
  606. -      ArgStr is one of the few argument translation routines that
  607. -      actually uses the copyf flag. If copyf is true then the
  608. -      string is duplicated.
  609. -      ArgStr assigns the    given string (or a copy    of it) to the
  610. -      value referenced by arg_valp(ad) (unless the argument is a
  611. -      vector in which case the given string is appended to the
  612. -      end).
  613. -      ArgStr ensures that the very last item in a vector    of
  614. -      strings (the one accessed as vec.array[ vec.count ]) will
  615. -      always be NULL.
  616. - Page 2
  617. - ARGTYPE(3)                           ARGTYPE(3)
  618. - CHARACTER-TYPES: argChar
  619. -      ArgChar assigns the given character to the    value referenced
  620. -      by    arg_valp(ad) (unless the argument is a vector in which
  621. -      case the given character is appended to the end).
  622. -      ArgChar ensures that the very last    item in    a vector of char-
  623. -      acter (the    one accessed as    vec.array[ vec.count ])    will
  624. -      always be a NULL byte so that the resulting vector    may also
  625. -      be    used as    a NULL terminated string.
  626. -      Unlike argStr, argChar will translate character escape
  627. -      sequences such as `\n' and    `\012'.
  628. - INTEGER-TYPES: argInt, argShort, argLong
  629. -      Each of these functions converts the given    string to the
  630. -      desired integral type. The    value may be specified as an
  631. -      octal number by specifying    the first digit    to be 0. Simi-
  632. -      larly, If the first two characters    are `0x' then the number
  633. -      is    treated    as hexadecimal.
  634. - FLOATING-POINT-TYPES: argFloat,    argDouble
  635. -      Each of these functions converts the given    string to the
  636. -      desired floating-point type.
  637. - BOOLEAN-TYPES: argBool,    argSBool, argTBool, argUBool
  638. -      ArgBool and argSBool set a    boolean    value (if no value is
  639. -      given).  ArgUBool unsets a    boolean    value (if no value is
  640. -      given). ArgTBool toggles a    boolean    value (if no value is
  641. -      given). If    a value    is supplied to any of these routines,
  642. -      then the string is    looked up in a table and assigned the
  643. -      corresponding value.
  644. -      If    a value    is supplied for    an argument that was matched via
  645. -      its single    character name and is part of the same argv ele-
  646. -      ment as the argument-name (so that    both ARGKEYWORD    and
  647. -      ARGVALSEP are not set), then only the first character of the
  648. -      value is used (unless it is not found in our table, in which
  649. -      case the value is ignored and the default action is taken).
  650. -      The table used for    single-character-options is the    follow-
  651. -      ing:
  652. -      `0' or `-'
  653. -       The corresponding boolean flag is set    to FALSE.
  654. -      `1' or `+'
  655. -       The corresponding boolean flag is set    to TRUE.
  656. -      `^' or `~'
  657. -       The corresponding boolean flag is toggled.
  658. -      The possible argument strings for long-options (keywords)
  659. -      are as follows (case-insensitive):
  660. - Page 3
  661. - ARGTYPE(3)                           ARGTYPE(3)
  662. -      ``0'', ``-'', ``OFF'', or ``FALSE''
  663. -       The corresponding boolean flag is set    to FALSE.
  664. -      ``1'', ``+'', ``ON'', or ``TRUE''
  665. -       The corresponding boolean flag is set    to TRUE.
  666. - LIST TYPES: listStr
  667. -      The listStr argument translation routine is only intended
  668. -      for use on    behalf of arguments that have the ARGLIST flag
  669. -      enabled. It will allocate space for a new node (and for the
  670. -      new string    if copyf is set) and append it to the end of the
  671. -      list. The argument-list may later be deallocated by invoking
  672. -      the function listFree and passing it the address of the
  673. -      first item    in the list.
  674. -      VecFree is    a macro    that is    used to    deallocate argument-
  675. -      vectors.  It will free the    array and flags    fields of a vec-
  676. -      tor, set them to NULL, and    set the    count field to zero. Vec-
  677. -      DeepFree is a macro that is similar to vecFree but    will
  678. -      additionally look at each item in the array; any component
  679. -      of    the array that had ARGCOPYF enabled will also be deallo-
  680. -      cated.  Both macros are given the vector structure    to free
  681. -      followed by the type of the items in the vector.
  682. - SEE ALSO
  683. -      parseargs(3), parseargs(1), parsecntl(3)
  684. - Page 4
  685. --- 0 ----
  686. diff -cNr ../patchlevel4/doc/Makefile ./doc/Makefile
  687. *** ../patchlevel4/doc/Makefile    Thu May  2 11:05:46 1991
  688. --- ./doc/Makefile    Tue May 14 12:32:17 1991
  689. ***************
  690. *** 90,101 ****
  691. X  ###
  692. X  # include dependencies
  693. X  ###
  694. ! argtype.3:
  695. ! parseargs.1:
  696. ! parseargs.3:
  697. ! parsecntl.3:
  698. X  
  699. X  
  700. X  ###
  701. X  # maintenance dependencies
  702. X  ###
  703. --- 90,140 ----
  704. X  ###
  705. X  # include dependencies
  706. X  ###
  707. ! argtype.3:    argtype.man3
  708. X  
  709. + parseargs.1:    parseargs.man1 \
  710. +         ../test.sh \
  711. +         argvalopt.inc \
  712. +         bugs.inc \
  713. +         caveats.inc \
  714. +         env_args.inc \
  715. +         env_parse.inc \
  716. +         env_usage.inc \
  717. +         parseargs1.inc \
  718. +         sh_arrays.inc \
  719. +         shells.inc
  720. X  
  721. + parseargs.3:    parseargs.man3 \
  722. +         arg_macros.inc \
  723. +         argdesc.inc \
  724. +         argflags.inc \
  725. +         caveats.inc \
  726. +         cmd_macros.inc \
  727. +         defargs.inc \
  728. +         effects.inc \
  729. +         env_args.inc \
  730. +         env_parse.inc \
  731. +         env_usage.inc \
  732. +         fparseargs3.inc \
  733. +         lib_bugs.inc \
  734. +         lparseargs3.inc \
  735. +         multivals.inc \
  736. +         parseargs3.inc \
  737. +         returns.inc \
  738. +         sparseargs3.inc \
  739. +         usage3.inc \
  740. +         vparseargs3.inc
  741. + parsecntl.3:    parsecntl.man3 \
  742. +         argflags.inc \
  743. +         effects.inc \
  744. +         parsecntl3.inc \
  745. +         parsecntls.inc \
  746. +         parseflags.inc \
  747. +         parsemodes.inc \
  748. +         returns.inc
  749. X  ###
  750. X  # maintenance dependencies
  751. X  ###
  752. ***************
  753. *** 105,111 ****
  754. X  clobber: clean
  755. X      ${DEL} *.txt
  756. X  
  757. ! spell: ${INCS} ${SRCS}}
  758. X      ${SPELL} ${SPELLFLAGS} ${INCS} ${SRCS}
  759. X  
  760. X  print: ${MANFILES} ${INCS}
  761. --- 144,150 ----
  762. X  clobber: clean
  763. X      ${DEL} *.txt
  764. X  
  765. ! spell: ${INCS} ${SRCS}
  766. X      ${SPELL} ${SPELLFLAGS} ${INCS} ${SRCS}
  767. X  
  768. X  print: ${MANFILES} ${INCS}
  769. diff -cNr ../patchlevel4/doc/arg_macros.inc ./doc/arg_macros.inc
  770. *** ../patchlevel4/doc/arg_macros.inc    Thu May  2 10:56:14 1991
  771. --- ./doc/arg_macros.inc    Thu May  2 14:34:39 1991
  772. ***************
  773. *** 27,33 ****
  774. X  .IP "\fIarg_sdesc\fP(ad)"
  775. X  Return the description of an argument. If a description was supplied,
  776. X  the \fI\s-1ARGDESCRIBED\s+1\fP flag will be set and the description will
  777. ! immediately follow the terminating NUL byte of the string name.
  778. X  .\"---------------------------------------------
  779. X  .IP "\fIARG_isDESCRIBED\fP(ad)"
  780. X  Evaluates to \s-1TRUE\s+1 only if an argument description was provided.
  781. --- 27,33 ----
  782. X  .IP "\fIarg_sdesc\fP(ad)"
  783. X  Return the description of an argument. If a description was supplied,
  784. X  the \fI\s-1ARGDESCRIBED\s+1\fP flag will be set and the description will
  785. ! immediately follow the terminating NULL byte of the string name.
  786. X  .\"---------------------------------------------
  787. X  .IP "\fIARG_isDESCRIBED\fP(ad)"
  788. X  Evaluates to \s-1TRUE\s+1 only if an argument description was provided.
  789. diff -cNr ../patchlevel4/doc/argdesc.inc ./doc/argdesc.inc
  790. *** ../patchlevel4/doc/argdesc.inc    Thu May  2 11:00:21 1991
  791. --- ./doc/argdesc.inc    Thu May  2 14:34:41 1991
  792. ***************
  793. *** 52,57 ****
  794. X  square-brackets, or angle-brackets). If the long-name contains any
  795. X  uppercase characters, then the substring of long-name consisting of
  796. X  all uppercase characters is used as the argument keyword and the entire
  797. ! long-name is used as the name of the argument (if a value my be
  798. X  supplied). The long-name may be matched by supplying a unique prefix
  799. X  of either the argument keyword or the argument name.
  800. --- 52,57 ----
  801. X  square-brackets, or angle-brackets). If the long-name contains any
  802. X  uppercase characters, then the substring of long-name consisting of
  803. X  all uppercase characters is used as the argument keyword and the entire
  804. ! long-name is used as the name of the argument (if a value may be
  805. X  supplied). The long-name may be matched by supplying a unique prefix
  806. X  of either the argument keyword or the argument name.
  807. diff -cNr ../patchlevel4/doc/argflags.inc ./doc/argflags.inc
  808. *** ../patchlevel4/doc/argflags.inc    Thu May  2 10:56:15 1991
  809. --- ./doc/argflags.inc    Thu May  2 14:34:44 1991
  810. ***************
  811. *** 51,57 ****
  812. X  .\"---------------------------------------------
  813. X  .IP "\fI\s-1ARGLIST\s+1\fP"
  814. X  A variable number of values are used for this argument (and hence may
  815. ! use more than one or two argv elements from the command-line as in
  816. X  "\fB\-l\fI val1 val2\fR ..."). The list of values must be stored in an
  817. X  .I ArgList
  818. X  structure (\s-1NOT\s+1 a vector structure), an the corresponding argument-type
  819. --- 51,57 ----
  820. X  .\"---------------------------------------------
  821. X  .IP "\fI\s-1ARGLIST\s+1\fP"
  822. X  A variable number of values are used for this argument (and hence may
  823. ! use more than one or two \f4argv\fP elements from the command-line as in
  824. X  "\fB\-l\fI val1 val2\fR ..."). The list of values must be stored in an
  825. X  .I ArgList
  826. X  structure (\s-1NOT\s+1 a vector structure), an the corresponding argument-type
  827. diff -cNr ../patchlevel4/doc/argtype.man3 ./doc/argtype.man3
  828. *** ../patchlevel4/doc/argtype.man3    Thu May  2 11:00:40 1991
  829. --- ./doc/argtype.man3    Thu May  2 14:34:47 1991
  830. ***************
  831. *** 37,45 ****
  832. X  all behave similarly. One of these routines is called when an
  833. X  argument of that particular type is matched by one of the argument
  834. X  parsing function in \fIparseargs\fP(3). When such an argument is matched,
  835. ! its argument translation routines is invoked and is passed (1) the address of
  836. X  the argument descriptor for the matched argument, (2) the possible argument
  837. ! string for that matched argument, and (3) a boolean filed that is \s-1TRUE\s+1
  838. X  only if the second parameter points to temporary storage (indicating that
  839. X  some copying may need to be done instead of just pointing to the same object).
  840. X  
  841. --- 37,45 ----
  842. X  all behave similarly. One of these routines is called when an
  843. X  argument of that particular type is matched by one of the argument
  844. X  parsing function in \fIparseargs\fP(3). When such an argument is matched,
  845. ! its argument translation routine is invoked and is passed (1) the address of
  846. X  the argument descriptor for the matched argument, (2) the possible argument
  847. ! string for that matched argument, and (3) a boolean field that is \s-1TRUE\s+1
  848. X  only if the second parameter points to temporary storage (indicating that
  849. X  some copying may need to be done instead of just pointing to the same object).
  850. X  
  851. ***************
  852. *** 128,134 ****
  853. X  in a table and assigned the corresponding value.
  854. X  
  855. X  If a value is supplied for an argument that was matched via its
  856. ! single character name and is part of the same argv element as the
  857. X  argument-name (so that both \fBARGKEYWORD\fP and \fBARGVALSEP\fP
  858. X  are not set),
  859. X  then only the first character of the value is used (unless it is
  860. --- 128,134 ----
  861. X  in a table and assigned the corresponding value.
  862. X  
  863. X  If a value is supplied for an argument that was matched via its
  864. ! single character name and is part of the same \f4argv\fP element as the
  865. X  argument-name (so that both \fBARGKEYWORD\fP and \fBARGVALSEP\fP
  866. X  are not set),
  867. X  then only the first character of the value is used (unless it is
  868. ***************
  869. *** 168,172 ****
  870. X  type of the items in the vector.
  871. X  .SH SEE ALSO
  872. X  .IR parseargs (3),
  873. ! .IR parseargs (3),
  874. ! .IR parsecntl (1),
  875. --- 168,172 ----
  876. X  type of the items in the vector.
  877. X  .SH SEE ALSO
  878. X  .IR parseargs (3),
  879. ! .IR parseargs (1),
  880. ! .IR parsecntl (3)
  881. diff -cNr ../patchlevel4/doc/bugs.inc ./doc/bugs.inc
  882. *** ../patchlevel4/doc/bugs.inc    Thu May  2 10:56:16 1991
  883. --- ./doc/bugs.inc    Thu May  2 14:34:52 1991
  884. ***************
  885. *** 27,38 ****
  886. X  .PP
  887. X  \fIParseargs\fP cannot properly preserve any newlines in shell variables
  888. X  if the \fBeval\fP command is used to read its output (this is a shortcoming
  889. ! of the eval command, not of parseargs). If the user is concerned about this
  890. ! particular case, then the user should redirect the output from \fBparseargs\fP
  891. ! to a temporary file and use the \fBsource\fP command in \fIcsh\fP or the
  892. ! dot command (`\fB.\fP') in sh and ksh, to interpret the results; otherwise,
  893. ! newlines will be translated into spaces, or characters following
  894. ! a newline may be lost, in any variables that are set by \fBparseargs\fP.
  895. ! .PP
  896. ! Parseargs(1) is subject to the same caveats as parseargs(3). Refer to the
  897. ! \s-1CAVEATS\s+1 section of the parseargs(3) manual page(s) for more information.
  898. --- 27,36 ----
  899. X  .PP
  900. X  \fIParseargs\fP cannot properly preserve any newlines in shell variables
  901. X  if the \fBeval\fP command is used to read its output (this is a shortcoming
  902. ! of the \fBeval\fP command, not of \fBparseargs\fP). If the user is concerned
  903. ! about this particular case, then the user should redirect the output from
  904. ! \fBparseargs\fP to a temporary file and use the \fBsource\fP command in
  905. ! \fIcsh\fP or the dot command (`\fB.\fP') in sh and ksh, to interpret the
  906. ! results; otherwise, newlines will be translated into spaces, or characters
  907. ! following a newline may be lost, in any variables that are set by
  908. ! \fBparseargs\fP.
  909. diff -cNr ../patchlevel4/doc/cmd_macros.inc ./doc/cmd_macros.inc
  910. *** ../patchlevel4/doc/cmd_macros.inc    Thu May  2 10:56:17 1991
  911. --- ./doc/cmd_macros.inc    Thu May  2 14:34:57 1991
  912. ***************
  913. *** 3,9 ****
  914. X  .\"--   xdoc -man -p '[ \t]*' -s CMD-MACROS ../parseargs.h
  915. X  .\"----------------------------------------------------------------------------
  916. X  .SH "CMD MACROS"
  917. ! Parseargs.h defines a set of macros to allow a more "self documenting"
  918. X  approach to declaring argument-descriptor arrays. The "old-style" is
  919. X  still accepted (but if used it is recommended that the \s-1STARTOFARGS\s+1
  920. X  macro is used in conjunction with \s-1ENDOFARGS\s+1).
  921. --- 3,9 ----
  922. X  .\"--   xdoc -man -p '[ \t]*' -s CMD-MACROS ../parseargs.h
  923. X  .\"----------------------------------------------------------------------------
  924. X  .SH "CMD MACROS"
  925. ! \f4<parseargs.h>\fP defines a set of macros to allow a more "self documenting"
  926. X  approach to declaring argument-descriptor arrays. The "old-style" is
  927. X  still accepted (but if used it is recommended that the \s-1STARTOFARGS\s+1
  928. X  macro is used in conjunction with \s-1ENDOFARGS\s+1).
  929. diff -cNr ../patchlevel4/doc/defargs.inc ./doc/defargs.inc
  930. *** ../patchlevel4/doc/defargs.inc    Thu May  2 10:56:18 1991
  931. --- ./doc/defargs.inc    Thu May  2 14:34:59 1991
  932. ***************
  933. *** 4,11 ****
  934. X  .\"----------------------------------------------------------------------------
  935. X  .SH "DEFAULT ARGUMENT DESCRIPTOR"
  936. X  .PP
  937. ! Each argdesc-array has an initial default argument list (which may
  938. ! be reset using the pc_DEFARGS function code with parsecntl). This initial
  939. X  default argument-list contains `?' and `H' which may be used as single
  940. X  character keywords to display command-usage for all command-line styles.
  941. X  Similarly, ``?'', ``H'', and ``Help'' may be used as long-keywords to display
  942. --- 4,11 ----
  943. X  .\"----------------------------------------------------------------------------
  944. X  .SH "DEFAULT ARGUMENT DESCRIPTOR"
  945. X  .PP
  946. ! Each argdesc-array has an initial default argument list (which may be reset
  947. ! using the pc_DEFARGS function code with \fIparsecntl\fP). This initial
  948. X  default argument-list contains `?' and `H' which may be used as single
  949. X  character keywords to display command-usage for all command-line styles.
  950. X  Similarly, ``?'', ``H'', and ``Help'' may be used as long-keywords to display
  951. ***************
  952. *** 12,17 ****
  953. X  command-usage for all command-line styles.  In Addition, for \s-1VMS\s+1
  954. X  style commands, the qualifiers \fB\s-1/INPUT\s+1=\fIfile\fR,
  955. X  \fB\s-1/OUTPUT\s+1=\fIfile\fR, and \fB\s-1/ERROR\s+1=\fIfile\fR, may be used
  956. ! to redirect stdin, stdout, and stderr (respectively) to a file.  For
  957. ! Amiga\s-1DOS\s+1 style commands, the keyword ``ENDKWDS'' may be used to
  958. ! disable parsing for any more keywords on the command-line.
  959. --- 12,17 ----
  960. X  command-usage for all command-line styles.  In Addition, for \s-1VMS\s+1
  961. X  style commands, the qualifiers \fB\s-1/INPUT\s+1=\fIfile\fR,
  962. X  \fB\s-1/OUTPUT\s+1=\fIfile\fR, and \fB\s-1/ERROR\s+1=\fIfile\fR, may be used
  963. ! to redirect \f4stdin\fP, \f4stdout\fP, and \f4stderr\fP (respectively) to a
  964. ! file.  For Amiga\s-1DOS\s+1 style commands, the keyword ``ENDKWDS'' may be
  965. ! used to disable parsing for any more keywords on the command-line.
  966. diff -cNr ../patchlevel4/doc/env_args.inc ./doc/env_args.inc
  967. *** ../patchlevel4/doc/env_args.inc    Thu May  2 11:00:46 1991
  968. --- ./doc/env_args.inc    Thu May  2 14:35:04 1991
  969. ***************
  970. *** 5,11 ****
  971. X  .SH "SUPPLYING DEFAULT ARGUMENTS"
  972. X  Programs that use \fIparseargs\fP may be given default arguments under UNIX
  973. X  and PCs through the use of environment variables (symbols are used for VMS
  974. ! systems). If a  C-program or shell-script uses parseargs to implement a
  975. X  command named ``\fIcmd\fP'' then the environment variable ``\s-1CMD_ARGS\s+1''
  976. X  will be parsed for any "default" arguments before the command-line is parsed.
  977. X  The command-line will over-ride any options that are specified in this
  978. --- 5,11 ----
  979. X  .SH "SUPPLYING DEFAULT ARGUMENTS"
  980. X  Programs that use \fIparseargs\fP may be given default arguments under UNIX
  981. X  and PCs through the use of environment variables (symbols are used for VMS
  982. ! systems). If a  C-program or shell-script uses \fIparseargs\fP to implement a
  983. X  command named ``\fIcmd\fP'' then the environment variable ``\s-1CMD_ARGS\s+1''
  984. X  will be parsed for any "default" arguments before the command-line is parsed.
  985. X  The command-line will over-ride any options that are specified in this
  986. diff -cNr ../patchlevel4/doc/env_parse.inc ./doc/env_parse.inc
  987. *** ../patchlevel4/doc/env_parse.inc    Thu May  2 11:00:56 1991
  988. --- ./doc/env_parse.inc    Thu May  2 14:35:06 1991
  989. ***************
  990. *** 8,19 ****
  991. X  The user may set his (or her) own desired parsing
  992. X  behavior through the use of the ``\s-1PARSECNTL\s+1'' environment variable.
  993. X  By indicating any number of flags (possibly negated) the user will
  994. ! directly modify the behavior of the parseargs library. Flags may be
  995. X  combined by placing a `+' or `|' character in between flags. A switch
  996. X  is negated by immediately preceding it with a `!' or `-' character.
  997. X  The possible ``flags'' are given by the following table. 
  998. X  Flags are case-insensitive.
  999. X  .sp 4p
  1000. X  .IP "\fIPrompt\fP"
  1001. X  Prompt the user for any missing arguments that are required on the
  1002. X  command-line. No special escaping or quoting is performed on the
  1003. --- 8,20 ----
  1004. X  The user may set his (or her) own desired parsing
  1005. X  behavior through the use of the ``\s-1PARSECNTL\s+1'' environment variable.
  1006. X  By indicating any number of flags (possibly negated) the user will
  1007. ! directly modify the behavior of the \fIparseargs\fP library. Flags may be
  1008. X  combined by placing a `+' or `|' character in between flags. A switch
  1009. X  is negated by immediately preceding it with a `!' or `-' character.
  1010. X  The possible ``flags'' are given by the following table. 
  1011. X  Flags are case-insensitive.
  1012. X  .sp 4p
  1013. + .\"---------------------------------------------
  1014. X  .IP "\fIPrompt\fP"
  1015. X  Prompt the user for any missing arguments that are required on the
  1016. X  command-line. No special escaping or quoting is performed on the
  1017. ***************
  1018. *** 20,61 ****
  1019. X  user input. Required arguments that expect a list of values will
  1020. X  be repeatedly prompted for (one item per line) until a blank line
  1021. X  (followed by a carriage return) is entered.
  1022. ! .\"----------------------
  1023. X  .IP "\fIIgnore\fP"
  1024. X  Ignore any unrecognized or improperly specified command-line arguments
  1025. ! and continue execution of the program. Normally, if an argument is
  1026. ! unmatched (or is improperly specified), a usage message is printed
  1027. ! and program execution is terminated.
  1028. ! .\"----------------------
  1029. X  .IP "\fIOptsOnly\fP"
  1030. ! Under UNIX, setting this flag will disable the parsing of long-option
  1031. ! syntax. This will cause all arguments starting with '+' to always be
  1032. X  treated as a positional parameter (instead of a long-option).
  1033. ! .\"----------------------
  1034. X  .IP "\fIKwdsOnly\fP"
  1035. ! Under UNIX, setting this flag disables the parsing of single-character
  1036. ! options.  This will cause all arguments starting with '-' to always
  1037. X  be treated as a positional parameter (instead of an option).
  1038. ! .\"----------------------
  1039. X  .IP "\fILoptsOnly\fP"
  1040. X  Same as \fIKwdsOnly\fP.
  1041. ! .\"----------------------
  1042. X  .IP "\fIFlags1st\fP"
  1043. ! Setting this flag causes the parseargs library to force any and all
  1044. X  non-positional arguments to be specified before any positional ones.
  1045. ! As an example, under UNIX, if this flag is SET then parseargs will
  1046. ! consider the command line "cmd -x arg" to consist of one option and
  1047. ! one positional argument; however the command line "cmd arg -x" would
  1048. ! be considered to consist of two positional arguments (the -x option
  1049. ! will be unmatched).
  1050. X  
  1051. ! If this flag is UNSET, then both of the previous examples are
  1052. X  considered to consist of one option and one positional argument.
  1053. ! .\"----------------------
  1054. X  .IP "\fICaseIgnore\fP"
  1055. ! Setting this flag causes character-case to be ignored when attempting
  1056. ! to match single-character argument names (i.e. causes "-i" and "-I"
  1057. ! will be considered equivalent).
  1058. X  .sp 4p
  1059. X  .PP
  1060. X  If the environment variable ``\s-1PARSECNTL\s+1'' is empty or
  1061. --- 21,64 ----
  1062. X  user input. Required arguments that expect a list of values will
  1063. X  be repeatedly prompted for (one item per line) until a blank line
  1064. X  (followed by a carriage return) is entered.
  1065. ! .\"---------------------------------------------
  1066. X  .IP "\fIIgnore\fP"
  1067. X  Ignore any unrecognized or improperly specified command-line arguments
  1068. ! and continue execution of the program. Normally, if a required argument is
  1069. ! unmatched (or an argument is improperly specified), a usage message is printed
  1070. ! program execution is terminated.
  1071. ! .\"---------------------------------------------
  1072. X  .IP "\fIOptsOnly\fP"
  1073. ! Under \s-1UNIX\s+1, setting this flag will disable the parsing of long-option
  1074. ! syntax. This will cause all arguments starting with `+' to always be
  1075. X  treated as a positional parameter (instead of a long-option).
  1076. ! .\"---------------------------------------------
  1077. X  .IP "\fIKwdsOnly\fP"
  1078. ! Under \s-1UNIX\s+1, setting this flag disables the parsing of single-character
  1079. ! options.  This will cause all arguments starting with `\-' to always
  1080. X  be treated as a positional parameter (instead of an option).
  1081. ! .\"---------------------------------------------
  1082. X  .IP "\fILoptsOnly\fP"
  1083. X  Same as \fIKwdsOnly\fP.
  1084. ! .\"---------------------------------------------
  1085. X  .IP "\fIFlags1st\fP"
  1086. ! Setting this flag causes the \fIparseargs\fP library to force any and all
  1087. X  non-positional arguments to be specified before any positional ones.
  1088. ! As an example, under \s-1UNIX\s+1, if this flag is \s-1SET\s+1 then
  1089. ! .I parseargs
  1090. ! will consider the command line "\fBcmd \-x\fI arg\fR" to consist of one
  1091. ! option and one positional argument; however the command line
  1092. ! "\fBcmd\fI arg -x\fR" would be considered to consist of two positional
  1093. ! arguments (the \fB\-x\fP option will be unmatched).
  1094. X  
  1095. ! If this flag is \s-1UNSET\s+1, then both of the previous examples are
  1096. X  considered to consist of one option and one positional argument.
  1097. ! .\"---------------------------------------------
  1098. X  .IP "\fICaseIgnore\fP"
  1099. ! Setting this flag will cause character-case to be ignored when attempting
  1100. ! to match single-character argument names (i.e. causes "\fB\-i\fP" and
  1101. ! "\fB\-I\fP" to be considered equivalent).
  1102. ! .\"---------------------------------------------
  1103. X  .sp 4p
  1104. X  .PP
  1105. X  If the environment variable ``\s-1PARSECNTL\s+1'' is empty or
  1106. diff -cNr ../patchlevel4/doc/env_usage.inc ./doc/env_usage.inc
  1107. *** ../patchlevel4/doc/env_usage.inc    Thu May  2 10:56:19 1991
  1108. --- ./doc/env_usage.inc    Thu May  2 14:35:08 1991
  1109. ***************
  1110. *** 16,22 ****
  1111. X  printed (this is also refferred to as ``terse'' mode). The other two ``modes''
  1112. X  control the displaying of option syntax and long-option syntax. A mode may
  1113. X  be explicitly disabled by preceding its corresponding string with the `!'
  1114. ! character. The ``modes'' which correspond to the possible values of the
  1115. X  ``\s-1USAGECNTL\s+1'' environment variable are given by the following table.
  1116. X  .sp 4p
  1117. X  .\"---------------------------------------
  1118. --- 16,22 ----
  1119. X  printed (this is also refferred to as ``terse'' mode). The other two ``modes''
  1120. X  control the displaying of option syntax and long-option syntax. A mode may
  1121. X  be explicitly disabled by preceding its corresponding string with the `!'
  1122. ! or `-' character. The ``modes'' which correspond to the possible values of the
  1123. X  ``\s-1USAGECNTL\s+1'' environment variable are given by the following table.
  1124. X  .sp 4p
  1125. X  .\"---------------------------------------
  1126. diff -cNr ../patchlevel4/doc/fparseargs3.inc ./doc/fparseargs3.inc
  1127. *** ../patchlevel4/doc/fparseargs3.inc    Thu May  2 10:56:20 1991
  1128. --- ./doc/fparseargs3.inc    Thu May  2 14:35:10 1991
  1129. ***************
  1130. *** 4,10 ****
  1131. X  .\"----------------------------------------------------------------------------
  1132. X  .PP
  1133. X  Given a readable input stream and an argdesc array, \fIfparseargs\fP
  1134. ! will parse arguments in a file in much the same manner as \fIparseargs\fP.
  1135. X  A maximum-line length of 255 characters is imposed.  NO ``escaping'' of any
  1136. X  kind is performed. Comments of a limited form are permitted: if the first
  1137. X  non-whitespace character on a line is a '#' (or '!' for \s-1VMS\s+1) then
  1138. --- 4,10 ----
  1139. X  .\"----------------------------------------------------------------------------
  1140. X  .PP
  1141. X  Given a readable input stream and an argdesc array, \fIfparseargs\fP
  1142. ! will parse arguments in a file in the same manner as \fIparseargs\fP.
  1143. X  A maximum-line length of 255 characters is imposed.  NO ``escaping'' of any
  1144. X  kind is performed. Comments of a limited form are permitted: if the first
  1145. X  non-whitespace character on a line is a '#' (or '!' for \s-1VMS\s+1) then
  1146. diff -cNr ../patchlevel4/doc/lparseargs3.inc ./doc/lparseargs3.inc
  1147. *** ../patchlevel4/doc/lparseargs3.inc    Thu May  2 11:01:17 1991
  1148. --- ./doc/lparseargs3.inc    Thu May  2 14:35:15 1991
  1149. ***************
  1150. *** 4,7 ****
  1151. X  .\"----------------------------------------------------------------------------
  1152. X  .PP
  1153. X  Given an ArgList and an argdesc array, \fIlparseargs\fP
  1154. ! will parse arguments in an ArgList in much the same manner as \fIparseargs\fP.
  1155. --- 4,7 ----
  1156. X  .\"----------------------------------------------------------------------------
  1157. X  .PP
  1158. X  Given an ArgList and an argdesc array, \fIlparseargs\fP
  1159. ! will parse arguments in an ArgList in the same manner as \fIparseargs\fP.
  1160. diff -cNr ../patchlevel4/doc/multivals.inc ./doc/multivals.inc
  1161. *** ../patchlevel4/doc/multivals.inc    Thu May  2 11:01:27 1991
  1162. --- ./doc/multivals.inc    Thu May  2 14:35:18 1991
  1163. ***************
  1164. *** 28,44 ****
  1165. X  the function
  1166. X  .I listFree.
  1167. X  .I ListFree
  1168. ! takes one parameter: first of which is the address of the first item in
  1169. ! the arg-list.
  1170. X  .PP
  1171. X  An alternative to argument-lists is argument vectors (or arg-vectors).
  1172. X  Arg-vectors use the \s-1ARGVEC\s+1 flag instead of the \s-1ARGLIST\s+1 flag
  1173. X  and do not require a special \fIlistXxxx\fP function for each vector-type.
  1174. X  Each of the \fIargXxxx\fP functions is responsible for handling vectors of its
  1175. ! type (although some argXxx functions such as the boolean types do not support
  1176. ! vectors). An arg-vector is a structure which contains a count, an
  1177. ! array of elements (i.e. an argc/argv pair), and an array of flags, one for 
  1178. ! each element of argv. There are two macros in defined in
  1179. X  \f4<parseargs.h>\fR which are used for arg-vectors. \s-1ARGVEC_T\s+1 may be
  1180. X  used to declare a vector structure or a vector type;
  1181. X  \s-1ARGVEC_EMPTY\s+1 may be used to initialize the structure.
  1182. --- 28,43 ----
  1183. X  the function
  1184. X  .I listFree.
  1185. X  .I ListFree
  1186. SHAR_EOF
  1187. true || echo 'restore of PATCH05 failed'
  1188. fi
  1189. echo 'End of  part 1'
  1190. echo 'File PATCH05 is continued in part 2'
  1191. echo 2 > _shar_seq_.tmp
  1192. exit 0
  1193. exit 0 # Just in case...
  1194. -- 
  1195. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1196. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1197. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1198. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1199.